home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d963.lha / SIOD / scm / onreset.scm < prev    next >
Text File  |  1993-08-19  |  869b  |  25 lines

  1. (define (call-on-reset p)
  2.         (if (proc? p)
  3.             (eval `(set! err-stack (cons ,p err-stack))
  4.                   on-reset-env)
  5.             (error "arg to call-on-reset must be a procedure"))
  6.         #t)
  7.  
  8. (define on-reset-env
  9.         (make-environment (define err-stack)
  10.                           (define p)
  11.                           (define (reset-handler)
  12.                                   (while err-stack
  13.                                          (set! p (car err-stack))
  14.                                          (set! err-stack (cdr err-stack))
  15.                                          (p)))))
  16.  
  17. (set! *on-reset* (access reset-handler on-reset-env))
  18.  
  19. (define (uncall-on-reset p)
  20.         (if (proc? p)
  21.         (eval `(set! err-stack (delq! ,p err-stack))
  22.               on-reset-env)
  23.             (error "arg to call-on-reset must be a procedure"))
  24.         #t)
  25.